Repository navigation
feat: expose parent Agent tool IDs in subagent callbacks - #1573
Open
austinchennn wants to merge 1 commit into
Open
austinchennn wants to merge 1 commit into
austinchennn wants to merge 1 commit into
Conversation
Author
|
The workflows for current head |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Tool-lifecycle hooks and
ToolPermissionContextexposeagent_idfor subagent calls but not the parentAgentcall'stool_use_id. A host cannot group the subagent's tool cards under the spawning call at hook time. Current Claude Code control requests do not include that parent ID, although the CLI writes it astoolUseIdin the subagent metadata sidecar already used byget_subagent_messages().The change
parent_tool_use_idto the four tool-lifecycle hook input types, SubagentStart/Stop hook inputs, andToolPermissionContext. Keep the new dataclass field last for positional compatibility.Nonewithout failing a callback.This addresses the SDK side of #1469. It does not change Claude Code's control payloads; sessions without a local sidecar still need CLI support to provide the ID. I am deliberately using
Refs #1469rather than auto-closing the issue until that limitation is reviewed.Testing
uv run --extra dev pytest tests/ -q: 1773 passed, 6 skipped.uv run --extra dev ruff check src/ tests/ scripts/,ruff format --check,mypy src/ scripts/, andgit diff --check: passed.can_use_toolrequests.Implementation and tests were assisted by OpenAI Codex; I reviewed the code and local checks.